﻿
class WasInitGrid implements IInitGrid {
    Execute(grid: IGrid) {
        for (var x = 0; x < grid.Width; x++) {
            for (var y = 0; y < grid.Height; y++) {
                var cell = grid.GetCellRaw(x, y);
                var state = CellState.Dead;
                var random = Math.random();
                if (random >= 0.80 && random < 0.81)
                    state = CellState.Sheep;
                else if (random >= 0.81 && random < 0.82)
                    state = CellState.Wolf;
                else if (random >= 0.82)
                    state = CellState.Gras;
                cell.InitCell(grid, state, x, y);
            }
        }
    }
} 